﻿using System;
using System.Collections.Generic;
using System.Text;
using MediaCenterCommander.LocalControl;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace CommandLineChannelChanger
{
    class Program
    {
        static void Main(string[] args)
        {
            MediaCenterLocalController.RegisterStandardChannels();            

            if (args.Length < 1)
            {
                Console.WriteLine("No channel specified.");
                Console.WriteLine("Example: CommandLineChannelChanger 35");
                return;
            }

            string arg = args[0];

            int channel = 0;
            if (arg != null && Int32.TryParse(arg, out channel))
            {                
                try
                {                    
                    MediaCenterLocalController.WatchChannel(channel);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Attempt to change channel failed: " + ex.Message); 
                }
            }
            else
            {
                Console.WriteLine("No channel specified: " + arg);
            }
        }
    }
}
